package com.becca.cake.service.address;

import java.util.List;
import java.util.Map;

import org.springframework.dao.DataAccessException;

import com.becca.cake.core.exception.ServiceException;
import com.becca.cake.model.address.CityModel;
import com.becca.cake.model.address.ProvinceModel;
import com.becca.cake.model.address.RegionModel;
import com.becca.cake.model.users.UserAddressModel;

/**
 * 地址管理service接口
 * @copyright  尊星(上海)信息科技有限公司
 * @author yellow
 * @date 2016年5月23日 下午12:09:18
 */
public interface IAddressService {
    /**
     * 查询省
     * @return
     */
    List<ProvinceModel> queryProvinces(Map<String, Object> map) throws Exception;

    /**
     * 跟居省ID查询市
     * @param provinceId
     * @return
     * @throws Exception
     */
    List<CityModel> queryCitysByProvinceId(String provinceId) throws Exception;

    /**
     * 根据市ID查询区县
     * @param cityId
     * @return
     * @throws Exception
     */
    List<RegionModel> queryRegionsByCityId(String cityId) throws Exception;

    /**
     *  查询该用户所有地址
     * @param map
     * @return
     * @throws ServiceException
     */
    List<UserAddressModel> selectAddressByUserId(Map<String, Object> map) throws ServiceException;

    /**
     * 获取查询用户地址的总条数
     * @param map
     * @return
     * @throws DataAccessException
     */
    Long selectUserAddressCount(Map<String, Object> map) throws ServiceException;

    /**
     * 修改用户地址状态
     * @param map
     * @throws ServiceException
     */
    void updateAdressStatus(Map<String, Object> map) throws ServiceException;

    /**
     * 修改地址是默认
     * @param map
     * @throws ServiceException
     */
    void updateAdressDefault(Map<String, Object> map) throws ServiceException;

    /**
     * 添加或修改用户地址信息
     * @param userAddressModel
     * @throws ServiceException
     */
    void addOrUpdUserAddress(UserAddressModel userAddressModel) throws ServiceException;

    /**
     * 根据id查询用户地址对象
     * @param id
     * @return
     * @throws DataAccessException
     */
    UserAddressModel selectUserAddressById(Integer id) throws ServiceException;
}
